
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;

namespace Swaf.BizRule
{
	/// <summary>
	/// Interface used for remote rule execution.
	/// </summary>
	public interface ISimpleRuleExecutor
	{
		/// <overloads>Executes business rules as both a facade and proxy.
		/// </overloads>
		/// <summary>
		/// 
		/// </summary>
		/// <param name="ruleName"></param>
		/// <param name="callParams"></param>
		/// <returns>string</returns>
		IResults execute(string ruleName, params object[] callParams);
		IResults simpleExecute(string ruleName, params object[] callParams);

		/// <summary> Execute a single business rule within the passed in context, returning after
		/// the rule has completed.</summary>
		/// <remarks>
		/// This method is meant to be called by business rules as a way to share context
		/// with a group of business rules in order to colaborate in a (potentially) 
		/// parallel fashion in a common context.
		/// </remarks>
		/// <param name="ruleName">
		/// </param>
		/// <param name="context">
		/// </param>
		/// <param name="callParams">
		/// </param>
		IResults execute(IRuleContext context, string ruleName, params object[] callParams);


		/// <summary> Executes multiple rules (potentially) in parallel, returning after all the
		/// rules specified have executed.</summary>
		/// <remarks>
		/// The <code>IResults</code> returned from this call will have the same number of
		/// sub-results in it as the number of rules specified.  It is this <i>multi-rule</i>
		/// execution that make the <code>RuleManager</code> so powerful.</remarks>
		/// <param name="ruleNames">
		/// </param>
		/// <param name="callParams">
		/// </param>
		/// <returns>
		/// IResults that contains a collection of results, one from each rule being called.
		/// </returns>
		IResults execute(string[] ruleNames, object[] callParams);
		IResults execute(IRuleContext context, string[] ruleNames, object[] callParams);
		IResults execute(string ruleName, ICollection callParams, bool multiCall);
		IResults execute(string ruleCallInfo);

		IResults remoteExecute(string ruleName, string remoteUrl, params object[] callParams);
		IResults remoteExecute(string[] ruleNames, string remoteUrl, params object[][] callParams);

	}
}
